// alert(3);
function update(thisB) {
    let personnelid = $("#personnelid").val()

    let department = $(".department").val()
    let status = $(".status").val()
    let position = $(".position").val()
    let positionid = $(".positionid").val()
    let name = $(".name").val()
    let sex = $(".sex").val()
    let email = $(".email").val()
    let pohone = $(".pohone").val()
    let address = $(".address").val()
    let cardid = $(".cardid").val()
    let originalHome = $(".originalHome").val();
    let politicsStatus = $(".politicsStatus").val()
    let school = $(".school").val()
    let specialty = $(".specialty").val()
    let educationBackground = $(".educationBackground").val()
    let salary = $(".salary").val()
    let openingBank = $(".openingBank").val()
    let cardNumbers = $(".cardNumbers").val()
    let socialNumbers = $(".socialNumbers").val()
    let registrant = $(".registrant").val()
    let inputtingTime = $(".inputtingTime").val()
    let curriculumVitae = $(".curriculumVitae").val()

    let FamilyInformation = $(".FamilyInformation").val()

    let comment = $(".comment").val()

    let attachment = $(".attachment").val();

    let xiugai = "审核中";

    if (department == "" || status == "" || position == "" || positionid == "" || name == "" || sex == "" || email == "" || pohone == "" ||
        address == "" || cardid == "" || originalHome == "" || politicsStatus == "" || school == "" || specialty == "" || educationBackground == "" ||
        salary == "" || openingBank == "" || cardNumbers == "" || socialNumbers == "" || registrant == "" || inputtingTime == "" || curriculumVitae == ""
        || FamilyInformation == "" || comment == "") {
        alert("所选内容均不能为空。请填写内容！")
        return;
    }

    let json = {
        personnelid: personnelid,
        department: department,
        position: position,
        status: status,
        positionid: positionid,
        name: name,
        sex: sex,
        email: email,
        pohone: pohone,
        address: address,
        cardid: cardid,
        originalHome: originalHome,
        politicsStatus: politicsStatus,
        school: school,
        specialty: specialty,
        educationBackground: educationBackground,
        salary: salary,
        openingBank: openingBank,
        cardNumbers: cardNumbers,
        socialNumbers: socialNumbers,
        registrant: registrant,
        inputtingTime: inputtingTime,
        curriculumVitae: curriculumVitae,
        FamilyInformation: FamilyInformation,
        comment: comment,
        attachment: attachment,
        xiugai: xiugai
    }

    $.ajaxSettings.async = false;
    $.getJSON("/update2", json, function (data) {
        if (data == true) {
            $(thisB).parent("tr").remove();
            alert("修改成功！")
            location.href = "/人事档案管理"
        } else {
            alert("修改失败！")
        }
    })
    $.ajaxSettings.async = true;
}

//复核
function fuhe1(thisA) {
    let personnelid = $("#personnelid").val()
    // alert(personnelid)
    let department = $(".department").val();
    let status = $(".status").val();
    let position = $(".position").val();
    let positionid = $(".positionid").val();
    let name = $(".name").val();
    let sex = $(".sex").val();
    let email = $(".email").val();
    let pohone = $(".pohone").val();
    let address = $(".address").val();
    let cardid = $(".cardid").val();
    let originalHome = $(".originalHome").val();
    let politicsStatus = $(".politicsStatus").val();
    let school = $(".school").val();
    let specialty = $(".specialty").val();
    let educationBackground = $(".educationBackground").val();
    let salary = $(".salary").val();
    let openingBank = $(".openingBank").val();
    let cardNumbers = $(".cardNumbers").val();
    let socialNumbers = $(".socialNumbers").val();
    let registrant = $(".registrant").val();
    let inputtingTime = $(".inputtingTime").val();
    let curriculumVitae = $(".curriculumVitae").val();
    let FamilyInformation = $(".FamilyInformation").val();
    let comment = $(".comment").val();
    let attachment = $(".attachment").val();
    let modification = $(".modification").val();

    let fuhe = "审核通过"
    // if (modification ==""){
    //     alert("请填写变更类型！")
    // }

    let json = {
        personnelid: personnelid,
        department: department,
        position: position,
        status: status,
        positionid: positionid,
        name: name,
        sex: sex,
        email: email,
        pohone: pohone,
        address: address,
        cardid: cardid,
        originalHome: originalHome,
        politicsStatus: politicsStatus,
        school: school,
        specialty: specialty,
        educationBackground: educationBackground,
        salary: salary,
        openingBank: openingBank,
        cardNumbers: cardNumbers,
        socialNumbers: socialNumbers,
        registrant: registrant,
        inputtingTime: inputtingTime,
        curriculumVitae: curriculumVitae,
        FamilyInformation: FamilyInformation,
        comment: comment,
        attachment: attachment,
        modification: modification,
        fuhe: fuhe
    }
    $.ajaxSettings.async = false;
    $.getJSON("/fuhe3", json, function (data) {
        if (data == true) {
            $(thisA).parent("tr").remove();
            alert("复核通过！")
            location.href = "/人事档案管理";
        }
    })
    $.ajaxSettings.async = true;
}

//变更
function BG(thisC) {

    let personnelid = $("#personnelid").val()
    let department = $(".department").val();
    let status = $(".status").val();
    let position = $(".position").val();
    let positionid = $(".positionid").val();
    let name = $(".name").val();
    let sex = $(".sex").val();
    let email = $(".email").val();
    let pohone = $(".pohone").val();
    let address = $(".address").val();
    let cardid = $(".cardid").val();
    let originalHome = $(".originalHome").val();
    let politicsStatus = $(".politicsStatus").val();
    let school = $(".school").val();
    let specialty = $(".specialty").val();
    let educationBackground = $(".educationBackground").val();
    let salary = $(".salary").val();
    let openingBank = $(".openingBank").val();
    let cardNumbers = $(".cardNumbers").val();
    let socialNumbers = $(".socialNumbers").val();
    let registrant = $(".registrant").val();
    let inputtingTime = $(".inputtingTime").val();
    let curriculumVitae = $(".curriculumVitae").val();
    let FamilyInformation = $(".FamilyInformation").val();
    let comment = $(".comment").val();
    let attachment = $(".attachment").val();
    let modification = $(".modification").val()
    let bian = "变更"

    if (modification == "") {
        alert("请填写变更类型！")
        return;
    }

    let json = {
        personnelid: personnelid,
        department: department,
        position: position,
        status: status,
        positionid: positionid,
        name: name,
        sex: sex,
        email: email,
        pohone: pohone,
        address: address,
        cardid: cardid,
        originalHome: originalHome,
        politicsStatus: politicsStatus,
        school: school,
        specialty: specialty,
        educationBackground: educationBackground,
        salary: salary,
        openingBank: openingBank,
        cardNumbers: cardNumbers,
        socialNumbers: socialNumbers,
        registrant: registrant,
        inputtingTime: inputtingTime,
        curriculumVitae: curriculumVitae,
        FamilyInformation: FamilyInformation,
        comment: comment,
        attachment: attachment,
        modification: modification,
        bain: bian

    }
    $.ajaxSettings.async = false;
    $.getJSON("/bianGeng", json, function (data) {
        if (data == true) {
            $(thisC).parent("tr").remove();
            alert("变更通过！")
            location.href = "/人事档案管理"
        }
    })
    $.ajaxSettings.async = true;
}

function BG2(thisD) {

    let personnelid = $("#personnelid").val()
    let department = $(".department").val();
    let status = $(".status").val();
    let position = $(".position").val();
    let positionid = $(".positionid").val();
    let name = $(".name").val();
    let sex = $(".sex").val();
    let email = $(".email").val();
    let pohone = $(".pohone").val();
    let address = $(".address").val();
    let cardid = $(".cardid").val();
    let originalHome = $(".originalHome").val();
    let politicsStatus = $(".politicsStatus").val();
    let school = $(".school").val();
    let specialty = $(".specialty").val();
    let educationBackground = $(".educationBackground").val();
    let salary = $(".salary").val();
    let openingBank = $(".openingBank").val();
    let cardNumbers = $(".cardNumbers").val();
    let socialNumbers = $(".socialNumbers").val();
    let registrant = $(".registrant").val();
    let inputtingTime = $(".inputtingTime").val();
    let curriculumVitae = $(".curriculumVitae").val();
    let FamilyInformation = $(".FamilyInformation").val();
    let comment = $(".comment").val();
    let attachment = $(".attachment").val();
    let modification = $(".modification").val()
    let bian2 = "变更审核中"

    if (modification == "") {
        alert("请填写变更类型！")
        return;
    }
    let json = {
        personnelid: personnelid,
        department: department,
        position: position,
        status: status,
        positionid: positionid,
        name: name,
        sex: sex,
        email: email,
        pohone: pohone,
        address: address,
        cardid: cardid,
        originalHome: originalHome,
        politicsStatus: politicsStatus,
        school: school,
        specialty: specialty,
        educationBackground: educationBackground,
        salary: salary,
        openingBank: openingBank,
        cardNumbers: cardNumbers,
        socialNumbers: socialNumbers,
        registrant: registrant,
        inputtingTime: inputtingTime,
        curriculumVitae: curriculumVitae,
        FamilyInformation: FamilyInformation,
        comment: comment,
        attachment: attachment,
        modification: modification,
        bain2: bian2

    }
    $.ajaxSettings.async = false;
    $.getJSON("/bianGeng2", json, function (data) {
        if (data == true) {
            $(thisD).parent("tr").remove();
            alert("变更申请通过！")
            location.href = "/人事档案管理"
        }
    })
    $.ajaxSettings.async = true;
}